<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath %>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增收入</title>
<link rel="stylesheet" href="static/css/base.css" media="all">
<link rel="stylesheet" href="static/layui/css/layui.css">
<script src="static/layui/layui.js"></script>
</head>
<body>
	<div style="padding: 10px;">
		<form class="layui-form" action="revenue/addRevenue">
			<div class="layui-form-item">
				<label class="layui-form-label">收入类型</label>
				<div class="layui-input-inline">
					<select name="type" lay-verify="required">
						<option value=""></option>
						<option value="工资收入">工资收入</option>
						<option value="理财收益">理财收益</option>
						<option value="其它收入">其它收入</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">金额</label>
				<div class="layui-input-block">
					<input type="number" name="money" autocomplete="off" lay-verify="required"
						placeholder="请输入金额" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">日期</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="create_date" id="create_date"
							placeholder="请选择日期">
				</div>
			</div>
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block">
					<textarea name="remark" placeholder="请输入备注" class="layui-textarea"></textarea>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
		<script type="text/javascript">
			layui.use(['form', 'jquery', 'laydate'], function() {
				var form = layui.form;
				var $ = layui.$;
				var laydate = layui.laydate;
				
				laydate.render({
					elem : '#create_date'
				});
				
				form.on('submit(demo1)', function(data){
					console.log(data.field);
					$.post($('form').attr("action"),data.field, function (data){
						if (data.result==true) {
							parent.layui.table.reload("demo");
							parent.layer.closeAll();
						}else {
							layer.msg('操作失败：' + data.msg, {icon: 2, time: 2000});
						}
					})
					return false;
				})
			})
		</script>
	</div>
</body>
</html>